<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@page import="org.springframework.web.context.WebApplicationContext"%>
<%@page import="org.springframework.web.context.support.WebApplicationContextUtils"%>
<%@page import="java.text.SimpleDateFormat"%>

<%@page import="java.io.File"%>
<%@page import="java.util.*"%>
<%@page import="javazoom.upload.*"%> 
<%@page import="uploadutilities.FileMover"%>
<%@page import="java.io.FileInputStream"%>
<%@page import="java.io.InputStream"%>
<%@page import="java.util.ArrayList"%>
<%@page import="java.util.List"%>
<%@page import="jxl.Cell"%>
<%@page import="jxl.Sheet"%>
<%@page import="jxl.Workbook"%>
<%@page import="jxl.WorkbookSettings"%>
<%!
 	//public Workbook wb;
	public List getListByJxl(String fileFullPath,boolean success,String message){
  		String content = null;
  		List listrow = new ArrayList();
  		jxl.Workbook book = null;
  		try{
			// 构造Workbook（工作薄）对象,此先将EXCEL文件装入内存,易引起内存溢出！ 
			InputStream is = new FileInputStream(fileFullPath);      
			book = Workbook.getWorkbook(is);
			//XSSFWorkbook wordbook=null;

    		//wordbook = new XSSFWorkbook(fileURL);
			if (book == null) {      
                return null;      
            }
            // 获得了Workbook对象之后，就可以通过它得到Sheet（工作表）对象了      
            Sheet sheet = book.getSheet(0);
            //获取表总列数
            int column = sheet.getColumns();
            int rows = sheet.getRows();
            for(int rowNum=0;rowNum<rows;rowNum++){
            	Cell[] cells = sheet.getRow(rowNum);
            	
            	List listcolumn = new ArrayList();
            	
            	//Map map = new HashMap();
            	if(cells.length==column){
	            	for(int i=0;i<column;i++){
	            		
	            		listcolumn.add(cells[i].getContents());
	            		
	            		//System.out.println(getExcelColumnLabel(i)+"<======>"+cells[i].getContents());
	            	}
	            	if(rowNum!=0){
	            		listrow.add(listcolumn);
	            	}
            	}
            }
            book.close();
            //System.out.println("====>"+listrow.size());
  		}catch (Exception e){ 
			e.printStackTrace(); 
		} finally {      
            // 最后关闭资源，释放内存      
          if (book != null) {      
              book.close();      
          }      
        }
  		return listrow;
 	}
	
	
	public String getExcelColumnLabel(int num){
		String temp="";
		double i = Math.floor(Math.log(25.0*(num)/26.0+1)/Math.log(26+1))+1;
		if(i>1){
			double sub=num-26*(Math.pow(26,i-1)-1)/25;
			for(double j=i;j>0;j--){
				temp = temp+(char)(sub/Math.pow(26,j-1)+65);
				sub = sub%Math.pow(26,j-1);
			}
		}else{
			temp=temp+(char)(num+65);
		}
		return temp;
	}

	
	
	
%>